mir: add back window hierarchy functions
authorWilliam Hua <william@attente.ca>
Thu, 8 Jan 2015 05:23:02 +0000 (00:23 -0500)
committerWilliam Hua <william@attente.ca>
Thu, 5 Feb 2015 16:26:19 +0000 (17:26 +0100)
gdk/mir/gdkmirwindowimpl.c

index 12451591fafc81ada8645293165ba3acdae7288d..d4a4f2db7596d615a423f4455ffa170031c29ab4 100644 (file)
@@ -924,6 +924,49 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
     ensure_no_surface (window);
 }
 
+/* TODO: Remove once we have proper transient window support. */
+GdkWindow *
+_gdk_mir_window_get_visible_transient_child (GdkWindow *window,
+                                             gdouble    x,
+                                             gdouble    y,
+                                             gdouble   *out_x,
+                                             gdouble   *out_y)
+{
+  GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+  GdkWindow *child = NULL;
+  GList *i;
+
+  x -= window->x;
+  y -= window->y;
+
+  if (x < 0 || x >= window->width || y < 0 || y >= window->height)
+    return NULL;
+
+  for (i = impl->transient_children; i && !child; i = i->next)
+    {
+      if (GDK_MIR_WINDOW_IMPL (GDK_WINDOW (i->data)->impl)->visible)
+        child = _gdk_mir_window_get_visible_transient_child (i->data, x, y, out_x, out_y);
+    }
+
+  if (child)
+    return child;
+
+  *out_x = x;
+  *out_y = y;
+
+  return window;
+}
+
+/* TODO: Remove once we have proper transient window support. */
+void
+_gdk_mir_window_transient_children_foreach (GdkWindow  *window,
+                                            void      (*func) (GdkWindow *, gpointer),
+                                            gpointer    user_data)
+{
+  GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+  g_list_foreach (impl->transient_children, (GFunc) func, user_data);
+}
+
 static void
 gdk_mir_window_impl_get_frame_extents (GdkWindow    *window,
                                        GdkRectangle *rect)